/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pe.edu.unmsm.cinfo.siga.datos;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author alumno
 */
@Entity
@Table(name = "DOCENTE")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Docente.findAll", query = "SELECT d FROM Docente d"),
    @NamedQuery(name = "Docente.findByDoceCod", query = "SELECT d FROM Docente d WHERE d.doceCod = :doceCod"),
    @NamedQuery(name = "Docente.findByDoceNom", query = "SELECT d FROM Docente d WHERE d.doceNom = :doceNom"),
    @NamedQuery(name = "Docente.findByDoceRuc", query = "SELECT d FROM Docente d WHERE d.doceRuc = :doceRuc"),
    @NamedQuery(name = "Docente.findByTpdId", query = "SELECT d FROM Docente d WHERE d.tpdId = :tpdId"),
    @NamedQuery(name = "Docente.findByDoceDir", query = "SELECT d FROM Docente d WHERE d.doceDir = :doceDir"),
    @NamedQuery(name = "Docente.findByDoceTel1", query = "SELECT d FROM Docente d WHERE d.doceTel1 = :doceTel1"),
    @NamedQuery(name = "Docente.findByDoceTel2", query = "SELECT d FROM Docente d WHERE d.doceTel2 = :doceTel2"),
    @NamedQuery(name = "Docente.findByDoceMail", query = "SELECT d FROM Docente d WHERE d.doceMail = :doceMail"),
    @NamedQuery(name = "Docente.findByDoceWeb", query = "SELECT d FROM Docente d WHERE d.doceWeb = :doceWeb"),
    @NamedQuery(name = "Docente.findByDocePw", query = "SELECT d FROM Docente d WHERE d.docePw = :docePw"),
    @NamedQuery(name = "Docente.findByDoceTopeMonto", query = "SELECT d FROM Docente d WHERE d.doceTopeMonto = :doceTopeMonto"),
    @NamedQuery(name = "Docente.findByDoceFechNac", query = "SELECT d FROM Docente d WHERE d.doceFechNac = :doceFechNac"),
    @NamedQuery(name = "Docente.findByDoceImpRent", query = "SELECT d FROM Docente d WHERE d.doceImpRent = :doceImpRent")})
public class Docente implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @GeneratedValue(generator="docenteCodGen")
    @SequenceGenerator(name="docenteCodGen", sequenceName="DOCENTE_COD_GEN", allocationSize=1)
    @Column(name = "DOCE_COD")
    private Integer doceCod;
    @Column(name = "DOCE_NOM")
    private String doceNom;
    @Column(name = "DOCE_RUC")
    private String doceRuc;
    @Column(name = "TPD_ID")
    private Short tpdId;
    @Column(name = "DOCE_DIR")
    private String doceDir;
    @Column(name = "DOCE_TEL1")
    private String doceTel1;
    @Column(name = "DOCE_TEL2")
    private String doceTel2;
    @Column(name = "DOCE_MAIL")
    private String doceMail;
    @Column(name = "DOCE_WEB")
    private String doceWeb;
    @Column(name = "DOCE_PW")
    private String docePw;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "DOCE_TOPE_MONTO")
    private Double doceTopeMonto;
    @Column(name = "DOCE_FECH_NAC")
    @Temporal(TemporalType.DATE)
    private Date doceFechNac;
    @Column(name = "DOCE_IMP_RENT")
    private Short doceImpRent;
    @OneToMany(mappedBy = "doceCod", fetch = FetchType.LAZY)
    private List<ModuloGrupo> moduloGrupoList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "doceCod", fetch = FetchType.LAZY)
    private List<ModuloCalendario> moduloCalendarioList;
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    
    public Docente() {
        this.doceNom = "";
    }

    public Docente(Integer doceCod) {
        this();
        this.doceCod = doceCod;
    }

    public Integer getDoceCod() {
        return doceCod;
    }

    public void setDoceCod(Integer doceCod) {
       Integer old = this.doceCod;
       this.doceCod = doceCod;
       changeSupport.firePropertyChange("doceCod", old, doceCod); 
    }

    public String getDoceNom() {
        return doceNom;
    }

    public void setDoceNom(String doceNom) {
       String old = this.doceNom;
       this.doceNom = doceNom;
       changeSupport.firePropertyChange("doceNom", old, doceNom); 
    }

    public String getDoceRuc() {
        return doceRuc;
    }

    public void setDoceRuc(String doceRuc) {
       String old = this.doceRuc;
       this.doceRuc = doceRuc;
       changeSupport.firePropertyChange("doceRuc", old, doceRuc); 
    }

    public Short getTpdId() {
        return tpdId;
    }

    public void setTpdId(Short tpdId) {
       Short old = this.tpdId;
       this.tpdId = tpdId;
       changeSupport.firePropertyChange("tpdId", old, tpdId); 
    }

    public String getDoceDir() {
        return doceDir;
    }

    public void setDoceDir(String doceDir) {
       String old = this.doceDir;
       this.doceDir = doceDir;
       changeSupport.firePropertyChange("doceDir", old, doceDir);  
    }

    public String getDoceTel1() {
        return doceTel1;
    }

    public void setDoceTel1(String doceTel1) {
       String old = this.doceTel1;
       this.doceTel1 = doceTel1;
       changeSupport.firePropertyChange("doceTel1", old, doceTel1); 
    }

    public String getDoceTel2() {
        return doceTel2;
    }

    public void setDoceTel2(String doceTel2) {
       String old = this.doceTel2;
       this.doceTel2 = doceTel2;
       changeSupport.firePropertyChange("doceTel2", old, doceTel2); 
    }

    public String getDoceMail() {
        return doceMail;
    }

    public void setDoceMail(String doceMail) { 
       String old = this.doceMail;
       this.doceMail = doceMail;
       changeSupport.firePropertyChange("doceMail", old, doceMail); 
    }

    public String getDoceWeb() {
        return doceWeb;
    }

    public void setDoceWeb(String doceWeb) {
       String old = this.doceWeb;
       this.doceWeb = doceWeb;
       changeSupport.firePropertyChange("doceWeb", old, doceWeb); 
    }

    public String getDocePw() {
        return docePw;
    }

    public void setDocePw(String docePw) {
       String old = this.docePw;
       this.docePw = docePw;
       changeSupport.firePropertyChange("docePw", old, docePw); 
    }

    public Double getDoceTopeMonto() {
        return doceTopeMonto;
    }

    public void setDoceTopeMonto(Double doceTopeMonto) {
       Double old = this.doceTopeMonto;
       this.doceTopeMonto = doceTopeMonto;
       changeSupport.firePropertyChange("doceTopeMonto", old, doceTopeMonto);
    }

    public Date getDoceFechNac() {
        return doceFechNac;
    }

    public void setDoceFechNac(Date doceFechNac) {
       Date old = this.doceFechNac;
       this.doceFechNac = doceFechNac;
       changeSupport.firePropertyChange("doceFechNac", old, doceFechNac);
    }

    public Short getDoceImpRent() {
        return doceImpRent;
    }

    public void setDoceImpRent(Short doceImpRent) {
       Short old = this.doceImpRent;
       this.doceImpRent = doceImpRent;
       changeSupport.firePropertyChange("doceImpRent", old, doceImpRent);
    }

    @XmlTransient
    public List<ModuloGrupo> getModuloGrupoList() {
        return moduloGrupoList;
    }

    public void setModuloGrupoList(List<ModuloGrupo> moduloGrupoList) {
       List old = this.moduloGrupoList;
       this.moduloGrupoList = moduloGrupoList;
       changeSupport.firePropertyChange("moduloGrupoList", old, moduloGrupoList);
    }

    @XmlTransient
    public List<ModuloCalendario> getModuloCalendarioList() {
        return moduloCalendarioList;
    }

    public void setModuloCalendarioList(List<ModuloCalendario> moduloCalendarioList) {
       List old = this.moduloCalendarioList;
       this.moduloCalendarioList = moduloCalendarioList;
       changeSupport.firePropertyChange("moduloCalendarioList", old, moduloCalendarioList);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (doceCod != null ? doceCod.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Docente)) {
            return false;
        }
        Docente other = (Docente) object;
        if ((this.doceCod == null && other.doceCod != null) || (this.doceCod != null && !this.doceCod.equals(other.doceCod))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
       return "pe.edu.unmsm.cinfo.siga.datos.Docente[ doceCod=" + doceCod + " ]";
    }
    
    public void addPropertyChangeListener(PropertyChangeListener l){
       changeSupport.addPropertyChangeListener(null);
    }
    
    public void removePropertyChangeListener(PropertyChangeListener l){
       changeSupport.removePropertyChangeListener(null);
    }
}
